import App from "./App";
import uviewPlus from "@/uni_modules/uview-plus";
import scUI from "@/uni_modules/sc-ui";
import * as Pinia from "pinia";
import { initRequest } from "./utils/request/index";
import { createSSRApp } from "vue";
import utils from "./utils/utils.js";
uni.$utils = utils;

export function createApp() {
  const app = createSSRApp(App);
  app.use(Pinia.createPinia());
  app.use(scUI, {
    color: {
      primary: "#1677FF",
    },
    button: {
      types: {
        primary: {
          color: "#fff",
          backgroundColor: "#1677FF",
          borderRadius: "8rpx",
          fontSize: "33rpx",
        },
        assist: {
          color: "#0F67FE",
          backgroundColor: "#E0E8F7",
          borderRadius: "8rpx",
          fontSize: "33rpx",
        },
        white: {
          color: "#0F67FE",
          backgroundColor: "#FFFFFF",
          borderRadius: "8rpx",
          fontSize: "33rpx",
        },
        "grey-blue": {
          color: "#0F67FE",
          backgroundColor: "#F0F0F0",
          borderRadius: "8rpx",
          fontSize: "33rpx",
        },
        "grey-red": {
          color: "#FF5050",
          backgroundColor: "#F0F0F0",
          borderRadius: "8rpx",
          fontSize: "33rpx",
        },

        line: {
          color: "#1677FF",
          borderRadius: "4rpx",
          fontSize: "18rpx",
          border: "1rpx solid #1677FF",
        },
      },
    },
    text: {
      fontSize: "33rpx",
    },
  });
  app.use(uviewPlus);
  initRequest(app);
  return {
    app,
    Pinia,
  };
}
